//
//  LRXPayHeadView.m
//  路人侠
//
//  Created by zhangxulong on 4/7/16.
//  Copyright © 2016 zhangxulong. All rights reserved.
//

#import "LRXPayHeadView.h"

@implementation LRXPayHeadView


- (void)addAddrcView:(NSString * )sendAddrText withBedRoom:(NSString *)BedRoomStr
{
    
    CGFloat addrBtnX = 33 * wScale;
    
    
    //设置购物地点样式

    UILabel * sendRemind = [[UILabel alloc]init];
    sendRemind.text = @"送达地址：";
    sendRemind.textColor = mainGrayColor;
    sendRemind.font = [UIFont systemFontOfSize:25 * hScale];
    sendRemind.frame = CGRectMake(addrBtnX, 64 * hScale,0,0);
    [sendRemind sizeToFit];
    

    
    //设置送达地点字样 样式
    CGFloat sendRemindX = CGRectGetMaxX(sendRemind.frame) + 10 * wScale;
    CGFloat sendRemindW = MainScreenW - sendRemindX - 50 * wScale;
    CGSize fontSize = [sendAddrText boundingRectWithSize:CGSizeMake(sendRemindW, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:25 * hScale]} context:nil].size;
    
    UILabel * sendAddrLabel = [[UILabel alloc]init];
    sendAddrLabel.text = sendAddrText;
    sendAddrLabel.textAlignment = NSTextAlignmentLeft;
    sendAddrLabel.font = [UIFont systemFontOfSize:25 * hScale];
    sendAddrLabel.frame = CGRectMake(sendRemindX, 64 * hScale, fontSize.width, fontSize.height);
    sendAddrLabel.numberOfLines = 0;
    
    CGFloat lineY = CGRectGetMaxY(sendAddrLabel.frame);
    
    if (BedRoomStr.length >= 1) {
        
        UILabel * bedRoom = [[UILabel alloc]init];
        bedRoom.frame = CGRectMake(addrBtnX, CGRectGetMaxY(sendRemind.frame) + 20 * hScale, 0, 0);
        bedRoom.text = @"送货上楼：";
        bedRoom.textColor = mainGrayColor;
        bedRoom.font = sendRemind.font;
        [bedRoom sizeToFit];
        
        UILabel * bedRoomLabel = [[UILabel alloc]init];
        CGFloat bedRoomLabelX = CGRectGetMaxX(bedRoom.frame) + 10 * wScale;
        bedRoomLabel.text = BedRoomStr;
        bedRoomLabel.font = bedRoom.font;
        bedRoomLabel.frame = CGRectMake(bedRoomLabelX, CGRectGetMaxY(sendRemind.frame) + 20 * hScale, 0, 0);
        [bedRoomLabel sizeToFit];
        
        lineY = CGRectGetMaxY(bedRoom.frame);
        
        [self addSubview:bedRoomLabel];
        [self addSubview:bedRoom];
    }
    
    

    //画线
    UIView * lineView2 = [[UIView alloc]init];
    lineView2.backgroundColor = [UIColor colorWithRed:222 green:222 blue:222];
    CGFloat line2Y = lineY+ 47 * hScale;
    lineView2.frame = CGRectMake(0, line2Y,MainScreenW ,2 * hScale);
    
    

    
    
    self.maxY = line2Y + 2 * hScale;
    [self addSubview:lineView2];
    [self addSubview:sendRemind];
    [self addSubview:sendAddrLabel];

}


@end
